package expr;

import hello.NamehelloVisitor;
import hello.helloLexer;
import hello.helloParser;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Ping
 * @date 2022/5/16 0:07
 **/
public class ExprDemo {
    public static void main(String args[]) {

        CharStream input = CharStreams.fromString("1+2+3+4") ;
        ExprLexer lexer = new ExprLexer(input) ;
        CommonTokenStream tokens = new CommonTokenStream(lexer) ;
        ExprParser parser = new ExprParser(tokens) ;
        ExprParser.ExprContext tree = parser.expr() ;

        ExprBaseVisitor visitor = new ExprBaseVisitor() ;
        Integer re = visitor.visit(tree) ;
        System.out.println("the final was " + re) ;
    }
}
